package com.hyacinth.aurora.core.bean;

import com.hyacinth.aurora.core.exception.BeansException;

import java.util.Map;

/**
 * bean 工厂
 * @author zhangfb
 * @version 1.0.0.1
 * @since JDK 1.8
 */
public interface BeanFactory {

    String FACTORY_BEAN_PREFIX = "&";

    /**
     * Register into bean Factory
     * @param object
     */
    void register(Object object);

    /**
     * Register into bean Factory
     * @param beanName bean name
     * @param object
     */
    void register(String beanName, Object object);


    <T> T getBean(Class<T> requiredType) throws BeansException;

    <T> T getBean(String name, Class<T> requiredType) throws BeansException;

    /**
     * Get bean from bean Factory
     * @param name
     * @return
     */
    Object getBean(String name) throws BeansException;

    /**
     * release all beans
     */
    void releaseBean() ;

    Map<String, Object> getBeanMap();
}
